﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NHibernate;
using NHibernate.Criterion;

namespace RM.Entities.Data
{
    public class QuestionManager : BaseManager
    {

        public IList<Question> GetAllBySearch(string searchString)
        {
            using (ISession session = DataManager.SessionFactory.OpenSession())
            {
                ICriteria criteria = session.CreateCriteria(typeof(Question));
                criteria.Add(Restrictions.Or(Restrictions.Like("Language", searchString, MatchMode.Start)
                    , Restrictions.Like("Technology", searchString, MatchMode.Start)));
                return criteria.AddOrder(new Order("Experience", true)).List<Question>();
            }
        }

    }
}
